<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" type="image/ico" th:href="@{/images/favicon.ico}">
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/index.css}">
    <title>轮播图列表</title>
    <style type="text/css">
        /**# 自定义表单的高度**/
        .layui-table-cell{
            height:auto;
            line-height:28px;
        }
    </style>
</head>
<body class="layui-tab-content">
<div class="layui-card layui-card-body">
<div class="layui-form toolbar" id="queryTools">
    <div class="layui-form-item">
        <label class="layui-form-label">轮播图名称:</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" id="bannerName" placeholder="请填写轮播图名称">
        </div>
        <label class="layui-form-label">所属类别:</label>
        <div class="layui-input-inline">
            <select id="bannerType">
            </select>
        </div>
        <label class="layui-form-label">创建时间:</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="date" class="layui-input" id="startDate" placeholder="请选择开始时间">
        </div>
        <div class="layui-input-inline">
            <input type="text" lay-verify="date" class="layui-input" id="endDate" placeholder="请选择结束时间">
        </div>
        <button class="layui-btn" id="btnSearch">查询</button>
        <button class="layui-btn" id="resetSearch">重置</button>
        <button class="layui-btn" id="btnAdd">新增</button>
    </div>
</div>
<table class="layui-hide" id="bannerTable" lay-filter="bannerTable"></table>
</div>
<!--新增修改界面-->
<form class="layui-form" id="editForm" lay-filter="editForm" style="display:none;padding-top:10px">
    <input type="hidden" name="bannerId">
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-tip-required">*</i>所属类别</label>
        <div class="layui-input-inline">
            <select name="bannerType"  lay-filter="selVal" lay-verify="required"></select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-tip-required">*</i>轮播图名称</label>
        <div class="layui-input-inline">
            <input type="text" name="bannerName" lay-verify="required" autocomplete="off" placeholder="请输入名称"
                   class="layui-input layui-form-danger">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-tip-required">*</i>轮播图位置</label>
        <div class="layui-input-inline">
            <select name="bannerPosition" lay-verify="required"></select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-tip-required">*</i>轮播图排序</label>
        <div class="layui-input-inline">
            <input type="text" name="sort" lay-verify="required" autocomplete="off" placeholder="请输入排序数值"
                   class="layui-input layui-form-danger">
            <div class="layui-form-mid layui-word-aux">*数字越小越靠前</div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">轮播图链接</label>
        <div class="layui-input-inline">
            <input type="text" name="bannerLink" autocomplete="off" placeholder="请输入超链接地址"
                   class="layui-input layui-form-danger">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-tip-required">*</i>轮播图显示</label>
        <div class="layui-input-inline" id="statusDiv">
           <!-- <input type="checkbox" name="status" lay-skin="switch" lay-text="开启|关闭" value="1">-->
            <!--<div class="layui-btn-status layui-btn-status-select">显示</div>
            <div class="layui-btn-status">不显示</div>-->
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-tip-required">*</i>轮播图/视频</label>
        <div class="layui-input-block">
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="uploadBtn">上传图片</button>
                <input name="bannerUrl" id="bannerUrl"  value="" autocomplete="off" class="layui-input" type="hidden">
                <div class="layui-upload-list" id="uploadListDiv">

                </div>
                <div id="imgText" class="layui-form-mid layui-word-aux">支持jpg，png，jpeg，mp4格式，图片最大只能上传10M，视频最大只能上传150M</div>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <button id="saveRecord" class="layui-btn" lay-submit lay-filter="editRecord">保存</button>
    </div>
</form>
<!--渲染列-->
<script type="text/html" id="imgRender">
    {{# if(d.bannerUrl.indexOf("image") != -1){ }}
        <img src="{{ d.bannerUrl }}" style="height: 137px;min-width: 200px;width: 200px;"/>
    {{# } else { }}
        <video src="{{ d.bannerUrl }}" style="height: 137px;width: 180px;"/>
    {{# } }}
</script>
<!--渲染列-->
<script type="text/html" id="statusClo">
    <!-- 这里的 checked 的状态只是演示 -->
    <input type="checkbox" name="sex" value="{{d.bannerId}}" lay-skin="switch" lay-filter="setStatus" {{ d.status == 1 ? 'checked' : '' }}>
</script>
<!--列操作-->
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<!--按钮操作-->
<script type="text/html" id="tableToolbar">
    <div class="layui-btn-container">

    </div>
</script>

<script type="text/javascript" th:src="@{/js/plugins/jquery-1.11.3.min.js}"></script>
<script type="text/javascript" th:src="@{/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/js/modules/banner/list.js}"></script>
</body>
</html>